home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Information / Digests / CSMP Digest / volume 3 / csmp-digest-v3-071 < prev    next >
Encoding:
Text File  |  1994-12-08  |  44.9 KB  |  832 lines  |  [TEXT/R*ch]

  1. ort       JMPInstruction;
  2.         void        *defProc;
  3.     } GenericMDEF;
  4.  
  5.     #if defined(powerc) || defined(__powerc)
  6.     #pragma options align=reset
  7.     #endif
  8.  
  9. Without them, you'll get two bytes of padding between the short and the
  10. void *.
  11.  
  12.  
  13. /Bo Lindbergh
  14.  
  15. +++++++++++++++++++++++++++
  16.  
  17. >From Graham@impro.demon.co.uk (Graham)
  18. Date: Wed, 9 Nov 1994 17:02:12 GMT
  19. Organization: N/A
  20.  
  21. I use the following routines to do this- on 68K macs it defaults to the
  22. old way of creating a stub for the jump, on PowerMacs it creates a
  23. routine dscriptor, so the same code works in all cases. try it.
  24.  
  25. #include    "MixedMode.h"
  26.  
  27. typedef struct
  28. {
  29.    short   Jmp;            // jmp instruction
  30.    void*   Routine;        // address to jump to
  31. }
  32. JmpInstructionTemplate;
  33.  
  34.  
  35. Handle    GetUniversalFunctionHandle(ProcPtr functionAddress,ProcInfoType
  36. pInfo);
  37. void     PatchJmpInstruction(void* patchAddress, void* jumpAddress);
  38.  
  39.  
  40.  
  41. Handle    GetUniversalFunctionHandle(ProcPtr functionAddress,ProcInfoType
  42. pInfo)
  43. {
  44.     Handle                pHNullProc = NULL;
  45.     ISAType                isa;
  46.     UniversalProcPtr     axDEFUPP;
  47.     
  48.     isa = GetCurrentISA();
  49.     
  50.     if (isa == kPowerPCISA)
  51.     {
  52.        pHNullProc = NewHandle(sizeof(RoutineDescriptor));
  53.        axDEFUPP = NewRoutineDescriptor(functionAddress,pInfo,isa);
  54.        BlockMove(axDEFUPP, *pHNullProc, sizeof(RoutineDescriptor));
  55.        DisposeRoutineDescriptor(axDEFUPP);
  56.     }
  57.     else
  58.     {
  59.        pHNullProc = NewHandle(sizeof(JmpInstructionTemplate));
  60.        PatchJmpInstruction(*pHNullProc, (void*)functionAddress);
  61.     }
  62.     return(pHNullProc);
  63. }
  64.  
  65.  
  66. void PatchJmpInstruction(void* patchAddress, void* jumpAddress)
  67. {
  68.    JmpInstructionTemplate* aJmpInstructionPtr;
  69.    
  70.    aJmpInstructionPtr = (JmpInstructionTemplate *) patchAddress;
  71.    aJmpInstructionPtr->Jmp = 0x4EF9;
  72.    aJmpInstructionPtr->Routine = jumpAddress;
  73. }
  74.  
  75.  
  76. You have to pass the proc info type for the routine, which youll have
  77. to look up in the universal headers, and the proc ptr to your MDEF
  78. function, it returns a handle which you simply stuff into the relevant
  79. defProc field.
  80. Apple DTS gave me the bones for this, so it even has the "official"
  81. stamp of approval!
  82.  
  83. ************************************************************************
  84. *
  85. MHROTD, Graham.  (Sorry, I haven't got time to think of
  86.                                        a witty signature)
  87.  
  88. +++++++++++++++++++++++++++
  89.  
  90. >From rang@winternet.com (Anton Rang)
  91. Date: 10 Nov 1994 14:33:59 GMT
  92. Organization: Trillium Research, Inc.
  93.  
  94. In article <Cz0FBo.FvL@demon.co.uk> Graham@impro.demon.co.uk (Graham) writes:
  95. >I use the following routines to do this- on 68K macs it defaults to the
  96. >old way of creating a stub for the jump, [...]
  97.  
  98.   Don't forget the posting last month from someone who had created a
  99. six-byte handle to hold their 'JMP $xxx' instruction and found that
  100. when the handle was moved by the memory manager, the i-cache wasn't
  101. flushed 'cause the handle was too small.  :)
  102. --
  103. Anton Rang (rang@winternet.com)
  104.  
  105. +++++++++++++++++++++++++++
  106.  
  107. >From Bruce@hoult.actrix.gen.nz (Bruce Hoult)
  108. Date: Fri, 11 Nov 1994 05:15:43 +1200 (NZST)
  109. Organization: (none)
  110.  
  111. rang@winternet.com (Anton Rang) writes:
  112. > In article <Cz0FBo.FvL@demon.co.uk> Graham@impro.demon.co.uk (Graham) writes:
  113. > >I use the following routines to do this- on 68K macs it defaults to the
  114. > >old way of creating a stub for the jump, [...]
  115. >   Don't forget the posting last month from someone who had created a
  116. > six-byte handle to hold their 'JMP $xxx' instruction and found that
  117. > when the handle was moved by the memory manager, the i-cache wasn't
  118. > flushed 'cause the handle was too small.  :)
  119.  
  120. I missed that one.
  121.  
  122. But I've never understood why people use the "six-byte resource" trick
  123. when it's so easy to use a "ten-byte resource" trick that is I-cache
  124. safe.
  125.  
  126. -- Bruce
  127.  
  128. ---------------------------
  129.  
  130. >From Jonathan Gary <jgary@ssd.kodak.com>
  131. Subject: Getting The PSN or Sig of AE Client
  132. Date: Tue, 8 Nov 1994 19:59:50 GMT
  133. Organization: Eastman Kodak
  134.  
  135. I'm trying to get the the PSN of the process that sends me an AE. I can
  136. get the
  137. address from the event, but how do I get at the PSN?
  138.  
  139. +++++++++++++++++++++++++++
  140.  
  141. >From wysocki@netcom.com (Chris Wysocki)
  142. Date: Friare fame)
  143. Pete Maruhnic (author of CA's Realizer for Windows)
  144.  
  145. So only one of us ended up at Metrowerks. Still, the product is pretty 
  146. much dead wrt PowerPC, as much my fault as anyone else's: a lot of the 
  147. code was written in assembly language, the context-switch mechanism would 
  148. probably not survive a port to the PPC, etc. It is rumored that Symantec 
  149. still has plans in the Pascal arena (but as you might imagine they don't 
  150. tell me that sort of thing anymore)
  151.  
  152. -- John McEnerney, Metrowerks PowerPC Product Architect
  153.  
  154.  
  155. +++++++++++++++++++++++++++
  156.  
  157. >From RobTerrell@vmedia.com (Rob Terrell)
  158. Date: 6 Nov 1994 21:26:52 GMT
  159. Organization: Jecta Development Corp.
  160.  
  161. John McEnerney said:
  162. > So only one of us ended up at Metrowerks. Still, the product is pretty
  163. > much dead wrt PowerPC, as much my fault as anyone else's: a lot of the
  164. > code was written in assembly language, the context-switch mechanism
  165. > would probably not survive a port to the PPC, etc. It is rumored that
  166. > Symantec still has plans in the Pascal arena (but as you might imagine
  167. > they don't tell me that sort of thing anymore)
  168.  
  169. Yeah, there was a rumor in MacWeek regarding this. I doubt it. The
  170. Symantec folks were real arrogant on the topic of the death of Pascal
  171. at the WWDC.
  172.  
  173. So, John, what's happening with Metrowerks' Pascal? I would totally
  174. abandon Think Pascal if CW supported an Object Pascal.
  175.  
  176.  
  177. Rob
  178.  
  179. +++++++++++++++++++++++++++
  180.  
  181. >From siegel@netcom.com (Rich Siegel)
  182. Date: Mon, 7 Nov 1994 17:57:38 GMT
  183. Organization: Bare Bones Software
  184.  
  185. In article <39j47d$gfq@spool.cs.wisc.edu> lbotez@picard.cs.wisc.edu (Lynda Botez) writes:
  186. >
  187. >Also, I think most of the programmers that developed Think Pascal are now
  188. >working for Metrowerks (the company that owns CodeWarrior); so you can
  189. >imagine that Think Pascal is not long for this world..
  190. >
  191.  
  192. That is not true.
  193.  
  194. Of the four people most directly involved in the development of THINK Pascal:
  195.  
  196. - one is at Metrowerks
  197. - one is director of the development tools group at Symantec
  198. - one is off doing something else (I don't recall where)
  199. - one is president and CEO of his own software company
  200.  
  201. When this question was recently posted to Symantec personnel at a
  202. recent BCS MacTechGroup meeting, the response was (basically) that
  203. they plan to work with certain third-party compiler makers to produce
  204. a Pascal solution for Rainbow (their new development environment that
  205. is currently under development).
  206.  
  207. R.
  208. -- 
  209. Rich Siegel % siegel@netcom.com    % President & CEO, Bare Bones Software Inc.
  210. --> For information about BBEdit, finger bbedit@world.std.com <--
  211.  
  212. +++++++++++++++++++++++++++
  213.  
  214. >From peter.lewis@info.curtin.edu.au (Peter N Lewis)
  215. Date: Tue, 08 Nov 1994 11:23:59 +0800
  216. Organization: NCRPDA, Curtin University
  217.  
  218. In article <39jhms$ja@redstone.interpath.net>, RobTerrell@vmedia.com (Rob
  219. Terrell) wrote:
  220.  
  221. >Yeah, there was a rumor in MacWeek regarding this. I doubt it. The
  222. >Symantec folks were real arrogant on the topic of the death of Pascal
  223. >at the WWDC.
  224.  
  225. A Symantec fellow told me that the rumour is crap.  There is no Symantec
  226. plans for a PPC pascal compiler.
  227.  
  228. >So, John, what's happening with Metrowerks' Pascal? I would totally
  229. >abandon Think Pascal if CW supported an Object Pascal.
  230.  
  231. You and me both.  I'm strugling on with THINK Pascal waiting for objects
  232. to show up in MW Pascal.  MW Pascal is scheduled to go 1.0 without objects
  233. in January (CW5), and MW Object Pascal is scheduled for CW6 in May (it
  234. better be there, otherwise Greg will have to face down some heckling at
  235. the WWDC :-).
  236.  
  237. The best you can do to help is to a) make sure MW knows that Object Pascal
  238. is what you need; b) buy MW CW; c) feed any bugs back to the MW bug report
  239. line as precisely as you can.  That's what i've been doing, an Marcel has
  240. been very good at fixing bugs (such that basically every bug I have
  241. reported has been fixed by the next version).
  242.  
  243. Enjoy,
  244.    Peter.
  245. -- 
  246. Peter N Lewis <peter.lewis@info.curtin.edu.au> - Macintosh TCP fingerpainter
  247. FTP my programs from redback.cs.uwa.edu.au:Others/PeterLewis/ or
  248. amug.org:pub/peterlewis/ or nic.switch.ch:software/mac/peterlewis/
  249.  
  250. ++++++++++++++++uld be released once I'm finished with it but, again, this
  251. function doesn't do that.  Am I wrong, is this function wrong, or is it
  252. simply not necessary, in this case, to release the resource?
  253.  
  254. FUNCTION setResStr(rsrcType:ResType; rsrcID:INTEGER; content:STR255):OSErr;
  255. VAR   
  256.   rsrcHdl : Handle;
  257.   result  : OSErr;
  258.          
  259. BEGIN
  260.   rsrcHdl := GetResource(rsrcType, rsrcID);
  261.   result := ResError;
  262.          
  263.   IF (rsrcHdl <> NIL) THEN BEGIN
  264.     SetHandleSize(rsrcHdl, LENGTH(content) + 1);          
  265.     BlockMove(@content, rsrcHdl^, LENGTH(content) + 1); 
  266.     ChangedResource(rsrcHdl);
  267.     result := ResError;                                              
  268.  
  269.     IF (result = NoErr) THEN BEGIN
  270.       WriteResource(rsrcHdl);
  271.       result := ResError;
  272.     END;                                       
  273.   END;
  274.   
  275.   setResStr :=
  276. result;                                                                    
  277.  
  278. END; {setResStr}
  279.  
  280.  
  281. Any help, hints, tips, suggestions would be appreciated.
  282. Roxanne.
  283.  
  284. -- 
  285. Roxanne Friesen
  286. Bell-Northern Research Ltd.
  287. roxanne@bnr.ca
  288.  
  289. +++++++++++++++++++++++++++
  290.  
  291. >From jones.794@osu.edu (Matt Jones)
  292. Date: Mon, 07 Nov 1994 19:15:24 +0500
  293. Organization: The Ohio State University
  294.  
  295. In article <roxanne-0711941153320001@47.221.33.54>, roxanne@bnr.ca (Roxanne
  296. Friesen) wrote:
  297.  
  298. > I'm trying to get a better *handle* on when handles should be disposed of
  299. > and resources released.
  300. > In the first sample function below, I would have thought that the alias
  301. > handle should be disposed of once the resource has been written to the
  302. > resource file but this function doesn't do that.  Am I wrong, is this
  303. > function wrong, or is it simply not necessary, in this case, to dispose of
  304. > the handle? (For the sake of simplifying the samples, assume I'm writing
  305. > to my apps own resource fork and not a prefs file of some kind ... or does
  306. > that make a difference?)
  307. > FUNCTION doCreateAlias(fileSpec:FSSpec):OSErr;
  308. > VAR
  309. >   alisHandle : AliasHandle;
  310. >   result : OSErr;
  311. > BEGIN
  312. >   result := NewAlias(NIL, fileSpec, alisHandle);
  313. >   IF (alisHandle <> NIL) THEN BEGIN
  314. >     AddResource(Handle(alisHandle), rAliasType, 128, 'File Alias');
  315. >     result := ResError;
  316. >     IF (result = NoErr) THEN BEGIN
  317. >       WriteResource(Handle(alisHandle));
  318. >       result := ResError;
  319. >     END;
  320. >   END;
  321. >  
  322. >   doCreateAlias := result;
  323. > END; {doCreateAlias}
  324. > In the second sample function below, again, I would have thought that the
  325. > resource should be released once I'm finished with it but, again, this
  326. > function doesn't do that.  Am I wrong, is this function wrong, or is it
  327. > simply not necessary, in this case, to release the resource?
  328. > FUNCTION setResStr(rsrcType:ResType; rsrcID:INTEGER; content:STR255):OSErr;
  329. > VAR   
  330. >   rsrcHdl : Handle;
  331. >   result  : OSErr;
  332. >          
  333. > BEGIN
  334. >   rsrcHdl := GetResource(rsrcType, rsrcID);
  335. >   result := ResError;
  336. >          
  337. >   IF (rsrcHdl <> NIL) THEN BEGIN
  338. >     SetHandleSize(rsrcHdl, LENGTH(content) + 1);          
  339. >     BlockMove(@content, rsrcHdl^, LENGTH(content) + 1); 
  340. >     ChangedResource(rsrcHdl);
  341. >     result := ResError;                                              
  342. >     IF (result = NoErr) THEN BEGIN
  343. >       WriteResource(rsrcHdl);
  344. >       result := ResError;
  345. >     END;                                       
  346. >   END;
  347. >   
  348. >   setResStr :=
  349. > result;                                                                    
  350. > END; {setResStr}
  351. > Any help, hints, tips, suggestions would be appreciated.
  352. > Roxanne.
  353. > -- 
  354. > Roxanne Friesen
  355. > Bell-Northern Research Ltd.
  356. > roxanne@bnr.ca
  357.  
  358. If your compiler is any good, it checks if any of the handles in local
  359. storage are still attached. ( I think ) Otherwise, you would be unable to
  360. find the handles to dispose of them later. However, this is tricky internal
  361. compiler stuff, much like pre-initialized variables. I always explicitly
  362. dispose of handles since the moment you assume your compiler does it for
  363. you, it stops.
  364. - ------------------------------------------------------------------------
  365. | it won't give up it wants me dead | |\  | | |  /| | jones.794          |
  366. | goddamn this noise inside my head | | \ | | | / | |    @ohio-state.edu |
  367. |                   Trent Reznor    | |  \| | |/  | | Stop the Clipper!  |
  368. - ------------------------------------------------------------------------
  369.  
  370. +++++++++++++++++++++++++++
  371.  
  372. >From sigurasg@rhi.hi.is (Sigurdur Asgeirsson)
  373. Date: Tue, 08 Nov 1994 09:49:56 -0100
  374. Organization: University of Iceland
  375.  
  376. In article <roxanne-0711941153320001@47.221.33.54>, roxanne@bnr.ca
  377. (Roxanne Friesen) wrote:
  378.  
  379. [snip]
  380.  
  381. > In the first sample function below, I would have thought that the alias
  382. > handle should be disposed of once the resource has been written to the
  383. > resource file but this function doesn't do that.  Am I wrong, is this
  384. > function wrong, or is it simply not necessary, in this case, to dispose of
  385. > the handle?
  386.  
  387. [snip]
  388.  
  389. > FUNCTION doCreateAlias(fileSpec:FSSpec):OSErr;
  390. > VAR
  391. >   alisHandle : AliasHandle;
  392. >   result : OSErr;
  393. > BEGIN
  394. >   result := NewAlias(NIL, fileSpec, alisHandle);
  395. >   IF (alisHandle <> NIL) THEN BEGIN
  396. >     AddResource(Handle(alisHandle), rAliasType, 128, 'File Alias');
  397. >     result := ResError;
  398. >     IF (result = NoErr) THEN BEGIN
  399. >       WriteResource(Handle(alisHandle));
  400. >       result := ResError;
  401. >     END;
  402. >   END;
  403. >  
  404. >   doCreateAlias := result;
  405. > END; {doCreateAlias}
  406. [second code example snipped for brevity]
  407.  
  408.   There is no need in this case to dispose the handle, unless the
  409. AddResource call fails, in which case the handle should be disposed of
  410. with DisposeHandle (since the handle is not a resource if the call fails -
  411. see below). 
  412.   In general there is no need to dispose of resource handles, because they
  413. are the responsibility of the Resource Manager. Resource handles must
  414. NEVER be disposed of via DisposeHandle, since that confuses the Resource
  415. Manager and you end up with heap corruption. (The Resource Manager does a
  416. DisposeHandle for all loaded resources in a resource file when the
  417. resource file is closed). 
  418.   If you feel the need to dispose of a resource handle when you're done
  419. with it (maybe because you'd like to free the memory that the resource is
  420. using) do it with the ReleaseResource call. It's generally better though
  421. to mark your resources as purgeable and leave it up to the Memory and
  422. Resource Managers to free the memory when needed. Be sure however, to use
  423. LoadResource in this case and mark the resource unpurgeable (or lock it)
  424. if you need to be sure that it doesn't "go away" while you're using it.
  425.  
  426. -- 
  427. Sigurdur Asgeirsson    | "Well you know, C isn't that hard, void (*(*f[])())()
  428. Kambasel 26            | for instance declares f as an array of unspecified
  429. 109 Reykjavik, Iceland | size, of pointers to functions that return pointers to
  430. sigurasg@rhi.hi.is     | functions that return void... I think"
  431.  
  432. +++++++++++++++++++++++++++
  433.  
  434. >From johns@efn.org (John Selhorst)
  435. Date: Tue, 8 Nov 1994 14:43:55 GMT
  436. Organization: hisself
  437.  
  438. In article <jones.794-071194191524@slip1-12.acs.ohio-state.edu>,
  439. jones.794@osu.edu (Matt Jones) wrote:
  440.  
  441. [ stuff from Roxanne deleted ]
  442.  
  443. > If your compiler is any good, it checks if any of the handles in local
  444. > storage are still attached. ( I think ) Otherwise, you would be unable to
  445. > find the handles to dispose of them later. However, this is tricky internal
  446. > compiler stuff, much like pre-initialized variables. I always explicitly
  447. > dispose of handles since the moment you assume your compiler does it for
  448. > you, it stops.
  449.  
  450. Wrong.  This is not fancy compiler stuff.  The handles Roxanne was
  451. referring to belong to the resource manager and the resource manager will
  452. dispose of them when it needs to.
  453.  
  454. Johnny
  455.  
  456. johns@efn.org
  457.  
  458. +++++++++++++++++++++++++++
  459.  
  460. >From Scott.Francis@SuperMac.com (eScott Francisternet alt.bbs.lists alt.bbs.lists.d alt.bbs.majorbbs alt.bbs.metal alt.bbs.pcboard alt.bbs.pcbuucp alt.bbs.renegade alt.bbs.searchlight alt.bbs.unixbbs alt.bbs.unixbbs.uniboard alt.bbs.uupcb alt.bbs.waffle alt.bbs.wildcat alt.beadworld alt.)
  461. Date: Tue, 08 Nov 1994 10:49:31 -0800
  462. Organization: Radius
  463.  
  464. In article <roxanne-0711941153320001@47.221.33.54>, roxanne@bnr.ca
  465. (Roxanne Friesen) wrote:
  466.  
  467. > I'm trying to get a better *handle* on when handles should be disposed of
  468. > and resources released.
  469.  
  470. In both cases the resource handle should be released with
  471. ReleaseResource().  Many programmers have not always done so, particularly
  472. when building apps since the res file will be closed (and all resources
  473. from that file released) when the app quits.  While calling
  474. ReleaseResource() is then not strictly necessary, it is good form, and can
  475. help some types of memory problems.
  476.  
  477. Another dimension to the problem:  If you will be refetching resources
  478. again and again, you might want to make the preloadable, and *not* release
  479. them.  This will keep them in memory and speed up the calls to
  480. GetResource().
  481.  
  482. --Scott
  483.  
  484. +++++++++++++++++++++++++++
  485.  
  486. >From mxmora@unix.sri.com (Matt Mora)
  487. Date: 8 Nov 1994 15:39:07 -0800
  488. Organization: SRI International, Menlo Park, CA
  489.  
  490. In article <roxanne-0711941153320001@47.221.33.54> roxanne@bnr.ca (Roxanne Friesen) writes:
  491. >I'm trying to get a better *handle* on when handles should be disposed of
  492. >and resources released.
  493.  
  494. Simple.  Handle are disposed and Resources are released.
  495.  
  496. >BEGIN
  497. >  result := NewAlias(NIL, fileSpec, alisHandle);
  498. >  IF (alisHandle <> NIL) THEN BEGIN
  499. >    AddResource(Handle(alisHandle), rAliasType, 128, 'File Alias');
  500.  
  501. At this point aliasHandle is no longer a plain ol handle. After you
  502. call Addresource the handle you supply becomes a ResourceHandle.
  503.  
  504. If its a resource handle what are you supposed to do with it? Yep
  505. ReleaseResource. 
  506.  
  507. DON'T CALL DISPOSEHANDLE AFTER YOU CALLED ADDRESOURCE ON THAT HANDLE.
  508.  
  509. >
  510. >In the second sample function below, again, I would have thought that the
  511. >resource should be released once I'm finished with it but, again, this
  512. >function doesn't do that.  Am I wrong, is this function wrong, or is it
  513. >simply not necessary, in this case, to release the resource?
  514.  
  515.  
  516. In the example that was shown, you don't have to call release resource
  517. if you might use that resource again. If you don't want it around
  518. go ahead and call release resource.
  519.  
  520. If the resource file is closed, the Resource handles will be released.
  521.  
  522. Xavier
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534. -- 
  535. ___________________________________________________________
  536. Matthew Xavier Mora                       Matt_Mora@sri.com
  537. SRI International                       mxmora@unix.sri.com
  538. 333 Ravenswood Ave                    Menlo Park, CA. 94025
  539.  
  540. +++++++++++++++++++++++++++
  541.  
  542. >From mxmora@unix.sri.com (Matt Mora)
  543. Date: 8 Nov 1994 15:40:13 -0800
  544. Organization: SRI International, Menlo Park, CA
  545.  
  546. In article <jones.794-071194191524@slip1-12.acs.ohio-state.edu> jones.794@osu.edu (Matt Jones) writes:
  547.  
  548. >If your compiler is any good, it checks if any of the handles in local
  549. >storage are still attached. ( I think ) Otherwise, you would be unable to
  550. >find the handles to dispose of them later. However, this is tricky internal
  551. >compiler stuff, much like pre-initialized variables. I always explicitly
  552. >dispose of handles since the moment you assume your compiler does it for
  553. >you, it stops.
  554.  
  555.  
  556. Huh?
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564. Xavier
  565.  
  566. -- 
  567. ___________________________________________________________
  568. Matthew Xavier Mora                       Matt_Mora@sri.com
  569. SRI International                       mxmora@unix.sri.com
  570. 333 Ravenswood Ave                    Menlo Park, CA. 94025
  571.  
  572. +++++++++++++++++++++++++++
  573.  
  574. >From peter.lewis@info.curtin.edu.au (Peter N Lewis)
  575. Date: Wed, 09 Nov 1994 11:27:40 +0800
  576. Organization: NCRPDA, Curtin University
  577.  
  578. In article <roxanne-0711941153320001@47.221.33.54>, roxanne@bnr.ca
  579. (Roxanne Friesen) wrote:
  580.  
  581. >In the first sample function below, I would have thought that the alias
  582. >handle should be disposed of once the resource has been written to the
  583. >resource file but this function doesn't do that.  Am I wrong, is this
  584. >function wrong, or is it simply not necessary, in this case, to dispose of
  585. >the handle? (For the sake of simplifying the samples, assume I'm writing
  586. >to my apps own resource fork and not a prefs file of some kind ... or does
  587. >that make a difference?)
  588.  
  589. First off, you must never call DisposeHandle on a resource handle, nor
  590. ReleaseResource on a non-resource handle.  Bad THings(tm) will happen. 
  591. There are a pair fo inits (DoubleTrouble and DisposeResource or some such)
  592. that catch bugs like this, available from ftp.apple.com:/mac/dts/ I
  593. believe.
  594.  
  595. Second, when you write a resource to a file, it's not necessayr to release
  596. it afterwards, since it will be automatically released when the resource
  597. file is closed (which tends to be quite soon afterwards anyway).  Also,
  598. you can set the handle to be purged (HPurge) and then it'll be released
  599. when memory is needed, but not until.  Make sure to call GetResource again
  600. to reload the (possibly) purged handle before reusing it.
  601.  
  602. Enjoy,
  603.    Peter.
  604. -- 
  605. Peter N Lewis <peter.lewis@info.curtin.edu.au> - Macintosh TCP fingerpainter
  606.  
  607. ---------------------------
  608.  
  609. >From fallside@rahul.net (David C. Fallside)
  610. Subject: Prograph 2.5
  611. Date: 10 Nov 1994 06:39:19 GMT
  612. Organization: a2i network
  613.  
  614. I recently accepted a $59.95 offer for Prograph 2.5. The promo blurb "Very
  615. High Level Pictorial Object-Oriented Programming Environment" seems to be
  616. accurate, and having worked my way through half of the tutorials, it seems
  617. that it should be possible to develop complex applications. But I'm not a
  618. professional programmer, and haven't found anyone else who has ever heard
  619. of Prograph. Any comments from Netland? Thank you.
  620. David
  621.  
  622. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  623. I'd rather be on the river ....
  624. K1/4, SQRT/3
  625. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  626.  
  627. +++++++++++++++++++++++++++
  628.  
  629. >From nick+@pitt.edu ( nick.c )
  630. Date: Thu, 10 Nov 1994 11:42:38 -0500
  631. Organization: The Pitt, Chemistry
  632.  
  633. In article <fallside-0911942243270001@382.rahul.net>, fallside@rahul.net
  634. (David C. Fallside) wrote:
  635.  
  636. > I recently accepted a $59.95 offer for Prograph 2.5. The promo blurb "Very
  637. > High Level Pictorial Object-Oriented Programming Environment" seems to be
  638. > accurate, and having worked my way through half of the tutorials, it seems
  639. > that it should be possible to develop complex applications. But I'm not a
  640. > professional programmer, and haven't found anyone else who has ever heard
  641. > of Prograph. Any comments from Netland? Thank you.
  642.  
  643.  
  644.    Prograph was my first environment (not counting hypercard), and
  645.       I consider that a mistake.  Don't get me wrong - prograph is
  646.       both a great concept and a great engineering feet.  I still
  647.       argue that inconic input will be the way we'll all code 10 years
  648.       from now (or sooner).  However, prograph is a dual mode environment,
  649.       it allows you to program at a low level, but defaults to a high
  650.       level environment by use of it's integrated class library.
  651.       As a result, and with the added factor there is very little
  652.       sample code or literature, it's hard to tell where the library
  653.       ends and the toolbox begins.  You can generate nice (albeit
  654.       large and slow) apps with 2.5.2 - nicer ones with CPX - but
  655.       you won't learn anything about Mac programming with it.
  656.  
  657.    To learn how to program the Mac you'll need to learn a classical
  658.       low level language (Pascal or C would be best), and when you do
  659.       you'll find you can generate much smaller, faster binaries and
  660.       have access to a wealth of established library code and example
  661.       code from all over the world.  My guess is most "professional"
  662.       programmers, don't want to give up those advantages.
  663.  
  664.    Prograph was marketed as a non-programmers programming language, and
  665.       I think that's still true.  However, as I said above, it does
  666.       allow low level coding, is very powerfull, and has the best
  667.       interface and debugger I've ever seen.  It's a glimpse of the
  668.       future of programming, and worth knowing, just remeber you 
  669.       get paid in the present.
  670.  
  671.  
  672.  Internet: nick+@pitt.edu            _/   _/  _/  _/_/_/   _/   _/  
  673.    eWorld: nick                     _/_/ _/  _/  _/   _/  _/_/_/ 
  674.       CIS: 71232,766               _/ _/_/  _/  _/       _/ _/    
  675.      http://www.pitt.edu/~nick/   _/   _/  _/   _/_/_/  _/   _/     
  676.                     
  677.  
  678. +++++++++++++++++++++++++++
  679.  
  680. >From pjensen@netcom.com (Peter Jensen)
  681. Date: Thu, 10 Nov 1994 16:53:40 GMT
  682. Organization: NETCOM Oname?
  683.  
  684. 2. What function calls should I use to be able to access a single frame? In the
  685.    Inside the Mac it says that a programmer can access every frame. How?
  686.  
  687. 3. Where does QuickTime store information about the frame rates (fps) of a movie? 
  688.    For example the frame rate that a movie was created with? 
  689.  
  690. 4. Is there a realtionship between frame rate (fps) and playback rate?  
  691.  
  692. 5. When QuickTime does not have enough time to display all the frames of a
  693.    movie, it starts dropping frames. Is there a pattern to this frame dropping?
  694.    For example does it drop everyother frame, or the third in every 3 frames? 
  695.    How does it decide which frames to drop?
  696.  
  697.  
  698.  
  699. thanx
  700. Ladan
  701.  
  702. +++++++++++++++++++++++++++
  703.  
  704. >From rich@cs.umd.edu (Richard Gerber)
  705. Date: 2 Nov 1994 19:44:03 -0500
  706. Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742
  707.  
  708. I am interested too.  But specifically: from within a quicktime player is there
  709. any way to dynamically determine -- as the movie is playing -- which particular 
  710. frames are being dropped.  
  711.  
  712. If not, what's the lowest level of granularity I can get to?
  713.  
  714. rich
  715.  
  716. - ----------
  717.  
  718. Richard Gerber
  719. Assistant Professor
  720.     
  721. Department of Computer Science
  722. University of Maryland
  723. College Park, MD  20742 USA
  724.  
  725. Email:   rich@cs.umd.edu
  726. Tel:     (301) 405-2710
  727. FAX:     (301) 405-6707
  728.  
  729.  
  730.  
  731. +++++++++++++++++++++++++++
  732.  
  733. >From ivan_cavero_belaunde@avid.com (Ivan Cavero Belaunde)
  734. Date: 8 Nov 1994 00:00:42 GMT
  735. Organization: Avid Technology, Inc.
  736.  
  737. In article <3998qv$7id@mingus.cs.umd.edu>, ladan@cs.umd.edu (Ladan Gharai)
  738. wrote:
  739. > Hi everyone
  740. > I am new to the QuickTime and am trying to understand how it works. I have
  741. > a bunch of questions and would appreciate any answers. I need to write a
  742. player
  743. > with very specific functionality. Going through the Inside the Mac: Quicktime
  744. > I have the following questions:
  745. > 1. A sample is defined as "A single element of a sequence of time-ordered
  746. >    data" does this mean that for a vedio a sample would be a frame?
  747.  
  748. Yup.
  749.  
  750. > 2. What function calls should I use to be able to access a single frame?
  751. In the
  752. >    Inside the Mac it says that a programmer can access every frame. How?
  753.  
  754. If I want the sample at time 10 on the first track:
  755.    theTrack = GetMovieIndTrack(theMovie, 1);
  756.    theMedia = GetTrackMedia(theTrack);
  757.    mediaTime = TrackTimeToMediaTime(theTrack, 10);
  758.    if (mediaTime != -1) {
  759.       err = GetMediaSample(theMedia, sampleDataHandle, 0, &sampleDataSize,
  760.             mediaTime, nil, nil, sampleDescriptionHandle, nil, 1, nil,
  761.             &sampleFlags);
  762.  
  763. > 3. Where does QuickTime store information about the frame rates (fps) of
  764. a movie? 
  765. >    For example the frame rate that a movie was created with? 
  766.  
  767. It doesn't since the frame rate can vary over time throughout the movie.
  768. You can estimate it by walking each track by track edits via
  769. GetTrackNextInterestingTime and then figuring out the frame rate for each
  770. edit by looking at the edit rate for each edit as well as the durations of
  771. the samples spanned by the edit.
  772.  
  773. > 4. Is there a realtionship between frame rate (fps) and playback rate?  
  774.  
  775. I'm not sure what you mean here. The QuickTime movie will never play at a
  776. better rate than its original stored rate - additionally, it is eminently
  777. possible to create a movie with too high a stored frame rate that will not
  778. play properly and will drop frames.
  779.  
  780. > 5. When QuickTime does not have enough time to display all the frames of a
  781. >    movie, it starts dropping frames. Is there a pattern to this frame
  782. dropping?
  783. >    For example does it drop everyother frame, or the third in every 3 frames? 
  784. >    How does it decide which frames to drop?
  785.  
  786. A movie has a "running clock" that tells it what "time" it is within the
  787. movie. When falling behind, QT will drop as many frames as necessary to
  788. catch up the frame being displayed with its running clock. The results are
  789. dependent on boatloads of factors, such as the horsepower of your machine,
  790. the bandwidth of your storage device, the seek speed of your storage
  791. device, the compression scheme used, the frame-differencing
  792. characteristics of the movie, and where within the movie the "playback
  793. head" is. There's no simple answer, sorry.
  794.  
  795. Hope this helps. Followups redirected to comp.sys.mac.programmer.
  796.  
  797. -Ivan
  798. - --
  799. Ivan Cavero Belaunde (ivan_cavero_belaunde@avid.com)
  800. Avid VideoShop Lead
  801. Avid Technology, Inc.
  802. Disclaimer:  All views expressed are entirely my own and do not
  803. reflect  the opinions of Avid Technology, Inc.
  804.  
  805. ---------------------------
  806.  
  807. End of C.S.M.P. Digest
  808. **********************
  809.  
  810.  
  811.